home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / command-not-found next >
Text File  |  2009-10-13  |  1KB  |  30 lines

  1. #!/usr/bin/python
  2. # (c) Zygmunt Krynicki 2005, 2006, 2007, 2008
  3. # Licensed under GPL, see COPYING for the whole text
  4.  
  5. __version__ = "0.2.21"
  6. BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/+source/command-not-found"
  7.  
  8. import CommandNotFound
  9. import sys
  10. from CommandNotFound.util import crash_guard, gettext_wrapper as _
  11. from CommandNotFound import CommandNotFound
  12. from optparse import OptionParser
  13.  
  14. def main():
  15.     parser = OptionParser(version = __version__, usage=_("%prog [options] <command-name>"))
  16.     parser.add_option('-d', '--data-dir', action='store',
  17.                       default="/usr/share/command-not-found",
  18.                       help=_("use this path to locate data fields"))
  19.     parser.add_option('--ignore-installed', '--ignore-installed',
  20.                       action='store_true',  default=False,
  21.                       help=_("ignore local binaries and display the available packages"))
  22.     (options, args) = parser.parse_args()
  23.     if len(args) == 1:
  24.         cnf = CommandNotFound(options.data_dir)
  25.         cnf.advise(args[0], options.ignore_installed)
  26.         print >>sys.stderr, _("%s: command not found") % args[0]
  27.  
  28. if __name__ == "__main__":
  29.     crash_guard(main, BUG_REPORT_URL, __version__)
  30.